import sys, socket
import codecs

# 手动注册 idna 编码器
try:
    codecs.lookup('idna')
except LookupError:
    import encodings.idna  # 强制注册

try:
    domain = sys.argv[1]
    result = socket.getaddrinfo(domain, None)
    print(result[0][4])
except Exception as e:
    print(f"An error occurred: {e}")